package com.application;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;

@Configuration
public class MainServerFactoryCustomizer implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory>  {

    @Override
    public void customize(ConfigurableServletWebServerFactory factory) {
       // UNAUTHORIZED
        factory.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "/static/401.html"));
        factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/static//404.html"));
       factory.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/static/500.html"));
    }
}
